package main

import (
	"flag"
	"fmt"
	"github.com/ngaut/log"
	"os"
)

var (
	logLevel    = flag.String("logLevel", "debug", "log level")
	enableStats = flag.Bool("enableStats", true, "whether enable statistics")
	// Bool flag不能写成 --logstdout 1 ，而是--logstdout=1
	logstdout   = flag.Bool("log-stdout", false, "log to stdout")
)


func t_ngaut_log() {
	flag.Parse()
	log.Info("before log is set ...")

	log.SetLevelByString(*logLevel)
	log.SetHighlighting(false)

	if *logstdout {
		fmt.Println("logstdout true")
		log.SetOutput(os.Stdout)
	} else {
		fmt.Println("logstdout false")
		log.SetRotateByHour()
		//log.SetSaveDays(30)
		pwd, _ := os.Getwd()
		log.SetOutputByName(fmt.Sprintf("%s/a.log", pwd))

	}

	log.Debug("debug info")
	log.Infof("info log")
	log.Warn("warn log")
	log.Errorf("error log")
}


func main() {

}